package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.entity.Product;
import com.ysd.entity.Productcategory;
import com.ysd.impl.ProductDaoImpl;
import com.ysd.impl.ProductcategoryDaolmpl;

public class MoHuServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String productName = request.getParameter("mohu");
		
		ProductDaoImpl mhDao  = new ProductDaoImpl();
		
		List<Product> mhList = mhDao.getProductsList2(productName);
		request.setAttribute("mhList", mhList);
		
		  response.setCharacterEncoding("UTF-8");
		
		ProductcategoryDaolmpl psDao = new ProductcategoryDaolmpl();
		
		List<Productcategory> ps = psDao.getProductcategory();
		request.setAttribute("ps", ps);
		
		request.getRequestDispatcher("mohu.jsp").include(request, response);
	}
}
